﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="InvoiceSelect.aspx.cs"
    Inherits="HZ.DrugTrade.Web.Hospitals.Collection.InvoiceSelect" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>选择发票</title>
    <link rel="stylesheet" type="text/css" href="../../lib/style/global.css" />

    <script src="../../lib/scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../lib/scripts/Common.js"></script>
    <script type="text/javascript" src="../../lib/scripts/global.js"></script>
    <script type="text/javascript" src="../../lib/scripts/jquery.js"></script>
    <script type="text/javascript" src="../../lib/scripts/mainlistSelect.js"></script>

    <script type="text/javascript" language="javascript">
      function addInfo() {
        if (checkSelectedItems('gvwDataInfo', '请至少选定一条记录！')) {
          var obj = new Object;
          obj.Receiptid = "";
          obj.Allmoney = "";
          obj.SID = "";
          var i, money = 0;
          var a = document.getElementsByName('chkChose');
          for (i = 0; i < a.length; i++) {
            if (a[i].checked == true) {
              obj.Receiptid += a[i].value + ",";
              money += Number(a[i].getAttribute('money'));
              obj.SID += "'" + a[i].getAttribute('sid') + "',";
            }
          }
          if (window.confirm("您所选择的发票总金额为" + money.toFixed(2) + ",\n\n是否保存?") == true) {
              obj.Allmoney = money.toFixed(2);
            self.opener.confirmvalue(obj);
            window.close();
          }
        }
        }
    
         
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div class="listsearch">
        <div class="querylist">
            <table>
                <tr>
                    <td>
                        <asp:Label ID="Label1" runat="server" Text="起始时间："></asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <asp:Label ID="Label2" runat="server" Text="截至时间："></asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtEndDate" runat="server"></asp:TextBox>
                    </td>
                    <td>
                        <hz:HzButton ID="btnQuery" runat="server" Text="查询" OnClick="btnQuery_Click" CssClass="btn"
                            Width="40px" />
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="listip">
        <ul>
            <li>小提示：<span>选择需要结算的发票复选框后,保存结果</span></li>
        </ul>
    </div>
    <br />
    <asp:GridView ID="gvwDataInfo" runat="server" AutoGenerateColumns="False" Width="580px"
        CssClass="mainlist" EmptyDataText="暂无符合条件的数据！">
        <Columns>
            <asp:TemplateField HeaderText="序号">
                <ItemTemplate>
                    <%#Container.DataItemIndex + 1 + AspNetPager1.PageSize*(AspNetPager1.CurrentPageIndex-1)%></ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="发票号">
                <ItemTemplate>
                    <%# Eval ("InvoiceID")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="InvoiceSerialID" HeaderText="发票流水号" Visible="false" />
            <asp:BoundField DataField="InvoiceTime" HeaderText="发票时间" DataFormatString="{0:d}" />
            <asp:BoundField DataField="TotalAmount" HeaderText="发票金额" />
            <asp:TemplateField HeaderText=" ">
                <HeaderTemplate>
                    <input id="chkAll" name="chkAll" type="checkbox" onclick="SelectAllCheckboxes(this,'gvwDataInfo','chkAll'); " />
                </HeaderTemplate>
                <ItemTemplate>
                    <input type="checkbox" name="chkChose" id="chkChose" value='<%#Eval("InvoiceID")%>'
                        money='<%#Eval("TotalAmount")%>' sid='<%#Eval("InvoiceSerialID")%>' onclick="chkChecked(this,'gvwDataInfo','chkAll');" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
     <div class="page">
    <webdiyer:AspNetPager ID="AspNetPager1" runat="server" OnPageChanged="AspNetPager1_OnPageChanged">
    </webdiyer:AspNetPager>
    </div>
    <div class="listctrl">
        &nbsp;
        <input id="Button1" type="button" onclick="openner=null;window.close();" value="关闭"
            class="btn" />
        <input id="Button2" type="button" onclick="addInfo();" value="选择" class="btn" />
    </div>
    <br />
    </form>
</body>
</html>
